{% extends 'base/base.html' %}
{% load my_tags %}

{% block title %}
    文章列表
{% endblock %}
{% block main %}
    <h1>文章列表</h1>
    {% for r in page_obj.object_list %}
        <ul class="list-group" style="position: relative">
            <li class="list-group-item"><a href="{% url 'main:article_detail' r.pk %}">{{ r }}</a>
        </ul>

    {% endfor %}

    <nav aria-label="Page navigation">
        <ul class="pagination">
            {% if page_obj.has_previous %}
                <li>
                    <a href="?page={{ page_obj.previous_page_number }}{{ query_suffix }}" aria-label="Previous">
                        <span aria-hidden="true">&laquo;</span>
                    </a>
                    {% else %}
                <li class="disabled">
                <a href="?page=1{{ query_suffix }}" aria-label="Previous">
                    <span aria-hidden="true">&laquo;</span>
                </a>
            {% endif %}

            </li>
            {% for i in paginator.page_range %}
                <li><a href="?page={{ i }}{{ query_suffix }}">{{ i }}</a></li>
            {% endfor %}
            {% if page_obj.has_next %}
                <li>
                    <a href="?page={{ page_obj.next_page_number }}{{ query_suffix }}" aria-label="Next">
                        <span aria-hidden="true">&raquo;</span>
                    </a>
                    {% else %}
                <li class="disabled">
                <a href="?page={{ page_obj.paginator.num_pages }}{{ query_suffix }}" aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                </a>

            {% endif %}

            </li>
        </ul>
    </nav>


{% endblock %}